import bb.cascades 1.2
import bb.WebImageView 1.4
import "../lib"

Container {
    property alias url: webImage.url
    property alias height: webImage.preferredHeight
    property alias width: webImage.preferredWidth
    
    layout: DockLayout {
    }
    
    Container {
        verticalAlignment: VerticalAlignment.Center
        horizontalAlignment: HorizontalAlignment.Center
        Label {
            id: statusText
            textStyle.base: style.titleStyle
        }
    }
    
    WebImageView {
        id: webImage
        verticalAlignment: VerticalAlignment.Center
        horizontalAlignment: HorizontalAlignment.Center
        scalingMethod: ScalingMethod.AspectFit
        
        onLoadingChanged: {
            statusText.text = qsTr("%1%").arg(Math.round(bytes*100/total))
        }
    }
    
    attachedObjects: [
        Common {
            id: style
        }
    ]
}
